<%--
  Created by IntelliJ IDEA.
  User: 段生伟
  Date: 2022/2/23
  Time: 9:54
  To change this template use File | Settings | File Templates.
--%>
<%@page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%

        request.setCharacterEncoding("UTF-8");
        String name = request.getParameter("username");
        String password = request.getParameter("password");
        String sex = request.getParameter("sex");
        if (null != name && name.equals("admin") && null != password && password.equals("123")){
            session.setAttribute("login",name);
            Cookie cookie = new Cookie("login","admin");
            cookie.setMaxAge(500);
            response.addCookie(cookie);
            response.sendRedirect("welcome.jsp");
//            response.sendRedirect("http://www.baidu.com");

//            session.setMaxInactiveInterval(60*10);
//            request.getRequestDispatcher("welcome.jsp").forward(request,response);

        }else {
            response.sendRedirect("denglu.jsp");
        }
    %>
    <%=sex%>
</body>
</html>
